package cn.edu.jxust.common.domain.web.api.enterprise;

import cn.edu.jxust.common.domain.entity.PollutionSourceType;
import cn.edu.jxust.common.response.Result;
import cn.edu.jxust.core.infrastructure.util.Const;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author QiuKangming
 * @version 1.0
 * @description
 * @since 2020/09/15 14:59
 */
@RequestMapping("/api/pst")
public interface IPollutionSourceTypeController {

    /**
     * 查询所有记录
     * @param page 第几页
     * @param size 一页几条数据
     * @return Result
     */
    @GetMapping
    @RequiresPermissions("pollutionsource:list")
    Result getAllPollutionSourceType(@RequestParam(value = "page",defaultValue = Const.DEFAULT_PAGE_NUMBER) Integer page,
                                     @RequestParam(value = "size",defaultValue = Const.DEFAULT_PAGE_SIZE) Integer size);

    /**
     * 根据id查询污染源类型
     * @param id 污染源id号
     * @return Result
     */
    @GetMapping("/{id}")
    @RequiresPermissions("pollutionsource:list")
    Result getOnePollutionSourceType(@PathVariable("id") @Validated Integer id);

    /**
     * 新增一条污染源记录
     * @param pollutionsourcetype 污染源视图对象
     * @param result 绑定结果集
     * @return Result
     */
    @PostMapping
    @RequiresPermissions("pollutionsource:add")
    Result addOnePollutionSourceType(@RequestBody PollutionSourceType pollutionsourcetype, BindingResult result);

    /**
     * 更新污染源信息
     * @param pollutionsourcetype 污染源视图对象
     * @param result 绑定结果集
     * @return Result
     */
    @PutMapping
    @RequiresPermissions("pollutionsource:edit")
    Result updateOnePollutionSourceType(@RequestBody PollutionSourceType pollutionsourcetype, BindingResult result);

    /**
     * 根据id删除一条污染源类型记录
     * @param id 污染源id号
     * @return Result
     */
    @DeleteMapping("/{id}")
    @RequiresPermissions("pollutionsource:del")
    Result deleteOnePollutionSourceType(@PathVariable("id") @Validated Integer id);
}
